package com.jnu.assistant.service.Impl;

import com.jnu.assistant.mapper.ChatMapper;
import com.jnu.assistant.pojo.Conversation;
import com.jnu.assistant.pojo.UserSessionId;
import com.jnu.assistant.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChatServiceImpl implements ChatService {

    @Autowired
    private ChatMapper chatMapper;

    @Override
    public void addConversation(Conversation conversation) {
        chatMapper.addConversation(conversation);
    }

    @Override
    public void addSession(UserSessionId userSessionId) {
        chatMapper.addSession(userSessionId);
    }

    @Override
    public List<UserSessionId> getSession(int userId) {
        return chatMapper.getSession(userId);
    }

    @Override
    public void deleteSession(int sessionId) {
        chatMapper.deleteSession(sessionId);
    }

    @Override
    public List<Conversation> getConversations(int sessionId) {
        return chatMapper.getConversations(sessionId);
    }

    @Override
    public void deleteConversations(int sessionId) {
        chatMapper.deleteConversations(sessionId);
    }
}
